# -*- coding: utf-8 -*-
# @Time : 2021/9/17 23:05
# @Author : WANGCHENYI
# @Email : wcy@gmail.com
# @File : recommended_page.py
# @Project : mryx_test
"""口碑推荐主页面"""
from page.base_page import BasePage
from appium.webdriver.webdriver import MobileBy as By
from time import sleep
class RecommendedPage(BasePage):
    """口碑推荐主页面类"""
    #定义定位器
    share_loctaor=(By.ID,'cn.missfresh.application:id/top_image')  #分享定位器
    circle_of_friends_loctaor=(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/'
                                        'android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/'
                                        'android.widget.LinearLayout/android.widget.LinearLayout[2]/'
                                        'android.widget.TextView[2]')   #朋友圈分享定位器
    cancel_share_loctaor=(By.XPATH,'//android.widget.ImageView[@content-desc="返回"]')   #取消分享定位器
    choose_goods_loctaor=(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/'
                                  'android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/'
                                  'android.widget.LinearLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout/'
                                  'android.widget.LinearLayout/android.widget.FrameLayout/android.webkit.WebView/'
                                  'android.webkit.WebView/android.view.View/android.view.View[2]/android.view.View[1]/'
                                  'android.view.View[2]/android.view.View[1]')  #点击商品
    def share(self):
        """点击分享"""
        self.driver.find_element(*self.share_loctaor).click()
    def circle_of_fridends(self):
        """朋友圈分享"""
        self.driver.find_element(*self.circle_of_friends_loctaor).click()
    def cancel_share(self):
        """取消分享"""
        self.driver.find_element(*self.cancel_share_loctaor).click()
    def choose_goods(self):
        """选择商品"""
        self.driver.find_element(*self.choose_goods_loctaor).click()